from openai import OpenAI
import sys
import os

# 添加项目根目录到Python路径
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))

from config_reader import get_siliconflow_config

# 获取Siliconflow配置
siliconflow_config = get_siliconflow_config()

client = OpenAI(api_key=siliconflow_config['api_key'],
                base_url=siliconflow_config['base_url'])
response = client.chat.completions.create(
    model="Qwen/Qwen3-8B",
    messages=[
        {'role': 'user', 'content': "你好！"}
    ],
    max_tokens=1024,
    temperature=0.7,
    stream=False
)
print(response.choices[0].message.content)